package com.px.user.mapper;

import com.px.user.entity.IPBlack;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IPBlackMapper {

    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert("insert into ip_black (creatorId,ip) values (#{creatorId},#{ip})")
    void insert(IPBlack ipBlack);

    @Delete("delete from ip_black where id=#{id}")
    void delete(Integer id);

    @Select("select * from ip_black order by ${orderField} limit #{startIndex},#{limit}")
    List<IPBlack> paging(IPBlack ipBlack);

    @Select("select count(1) from ip_black order by ${orderField}")
    Integer pagingCount(IPBlack ipBlack);
}
